﻿
USE [SqlServerTest]
GO
/****** Object:  Table [dbo].[TOBJECT]    Script Date: 10/19/2009 23:12:30 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TOBJECT](
	[ID] [int] NOT NULL,
	[EXT_ID] [int] NULL,
	[PARENT_ID] [int] NULL,
	[CLASS_ID] [int] NULL,
	[NAME] [varchar](100) COLLATE Cyrillic_General_CI_AS NULL,
 CONSTRAINT [PK_TOBJECT] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF

-----------------
USE [SqlServerTest]
GO
/****** Object:  Table [dbo].[TCLASSES]    Script Date: 10/19/2009 23:13:36 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TCLASSES](
	[ID] [int] NOT NULL,
	[Name] [varchar](250) COLLATE Cyrillic_General_CI_AS NULL,
	[GROUP_NAME] [varchar](250) COLLATE Cyrillic_General_CI_AS NULL,
	[FORM] [varchar](250) COLLATE Cyrillic_General_CI_AS NULL,
 CONSTRAINT [PK_TCLASSES] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
-----------------
USE [SqlServerTest]
GO
/****** Object:  Table [dbo].[TPROCESSES]    Script Date: 10/19/2009 23:14:02 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TPROCESSES](
	[ID] [int] NOT NULL,
	[CLASS_ID] [int] NOT NULL,
	[NAME] [varchar](250) COLLATE Cyrillic_General_CI_AS NULL,
	[FORM] [varchar](250) COLLATE Cyrillic_General_CI_AS NULL,
 CONSTRAINT [PK_TPROCESSES] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
-----------------
USE [SqlServerTest]
GO
/****** Object:  Table [dbo].[TRULE_INSERT]    Script Date: 10/19/2009 23:14:31 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TRULE_INSERT](
	[ID] [int] NOT NULL,
	[CLASS_ID] [int] NOT NULL,
	[CHILD_ID] [int] NOT NULL,
 CONSTRAINT [PK_TRULE_INSERT] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

-----------------

USE [SqlServerTest]
GO
/****** Object:  Table [dbo].[DIVISION]    Script Date: 10/18/2009 19:14:43 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[DIVISION](
	[ID] [int] NOT NULL,
	[BOSS_ID] [int] NULL,
	[DATE_CREATED] [datetime] NULL,
	[DESCRIPTION] [varchar](200) COLLATE Cyrillic_General_CI_AS NULL,
 CONSTRAINT [PK_DIVISION] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
ALTER TABLE [dbo].[DIVISION]  WITH NOCHECK ADD  CONSTRAINT [FK_DIVISION_TOBJECT] FOREIGN KEY([ID])
REFERENCES [dbo].[TOBJECT] ([ID])
NOT FOR REPLICATION 
GO
ALTER TABLE [dbo].[DIVISION] CHECK CONSTRAINT [FK_DIVISION_TOBJECT]

----------------------------------

USE [SqlServerTest]
GO
/****** Object:  Table [dbo].[SERVICE_DIVISION]    Script Date: 10/18/2009 19:15:20 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[SERVICE_DIVISION](
	[ID] [int] NOT NULL,
	[ROOM_ID] [int] NULL,
	[TELEPHONE] [varchar](100) COLLATE Cyrillic_General_CI_AS NULL,
 CONSTRAINT [PK_SERVICE_DIVISION] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF

-----------------------------------

USE [SqlServerTest]
GO
/****** Object:  Table [dbo].[ORGANIZATIONAL_DIVISION]    Script Date: 10/18/2009 19:15:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[ORGANIZATIONAL_DIVISION](
	[ID] [int] NOT NULL,
	[SLOGAN] [varchar](100) COLLATE Cyrillic_General_CI_AS NULL,
	[EMAIL] [varchar](100) COLLATE Cyrillic_General_CI_AS NULL,
 CONSTRAINT [PK_ORGANIZATIONAL_DIVISION] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF

--------------------------------------

USE [SqlServerTest]
GO
/****** Object:  Table [dbo].[MANAGING_DIVISION]    Script Date: 10/18/2009 19:17:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MANAGING_DIVISION](
	[ID] [int] NOT NULL,
	[SUBSTITUTE_ID] [int] NULL,
	[SUBORDERED_DIVISION_ID] [int] NULL,
 CONSTRAINT [PK_MANAGING_DIVISION] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

------------------------------------

USE [SqlServerTest]
GO
/****** Object:  Table [dbo].[CLUB]    Script Date: 10/18/2009 19:17:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CLUB](
	[ID] [int] NOT NULL,
	[ROOM_ID] [int] NULL,
	[SPECIALITY] [varchar](200) COLLATE Cyrillic_General_CI_AS NULL,
 CONSTRAINT [PK_CLUB] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF

--------------------------------

USE [SqlServerTest]
GO
/****** Object:  Table [dbo].[REST_DIVISION]    Script Date: 10/18/2009 19:18:35 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[REST_DIVISION](
	[ID] [int] NOT NULL,
	[LOCATION_ID] [int] NULL,
	[TELEPHONE] [varchar](100) COLLATE Cyrillic_General_CI_AS NULL,
 CONSTRAINT [PK_REST_DIVISION] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF

---------------------------------------

USE [SqlServerTest]
GO
/****** Object:  Table [dbo].[SECTION]    Script Date: 10/18/2009 19:19:07 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[SECTION](
	[ID] [int] NOT NULL,
	[LOCATION_ID] [int] NULL,
	[ROOM_ID] [int] NULL,
	[SCHEDULE] [varchar](500) COLLATE Cyrillic_General_CI_AS NULL,
 CONSTRAINT [PK_SECTION] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF